/* Define to 1 if the <elf.h> and <link.h> header file exist. */
#mesondefine HAVE_EXE_INTROSPECTION
-/* Whether GNOME Shell is built with X11 support */
-#mesondefine HAVE_X11
-
-/* Whether GNOME Shell is built with X11 clients support */
-#mesondefine HAVE_X11_CLIENT
+/* Whether GNOME Shell is built with XWayland support */
+#mesondefine HAVE_XWAYLAND
unitconf = configuration_data()
unitconf.set('bindir', bindir)
supported_sessions = ['wayland']
- if have_x11
- configure_file(
- input: 'org.gnome.Shell@x11.service.in',
- output: 'org.gnome.Shell@x11.service',
- configuration: unitconf,
- install_dir: systemduserunitdir
- )
- supported_sessions += ['x11']
- endif
configure_file(
input: 'org.gnome.Shell@wayland.service.in',
+++ /dev/null
-[Unit]
-Description=GNOME Shell on X11
-# On X11, try to show the GNOME Session Failed screen
-OnFailure=org.gnome.Shell-disable-extensions.service gnome-session-failed.target
-OnFailureJobMode=replace
-CollectMode=inactive-or-failed
-RefuseManualStart=on
-RefuseManualStop=on
-
-After=gnome-session-manager.target
-
-Requisite=gnome-session-initialized.target
-PartOf=gnome-session-initialized.target
-Before=gnome-session-initialized.target
-
-ConditionEnvironment=XDG_SESSION_TYPE=%I
-
-# Limit startup frequency more than the default
-StartLimitIntervalSec=15s
-StartLimitBurst=3
-
-[Service]
-Slice=session.slice
-Type=notify
-ExecStart=@bindir@/gnome-shell
-# Exit code 1 means we are probably *not* dealing with an extension failure
-SuccessExitStatus=1
-
-# On X11 we do not need to unset any variables
-
-# On X11 we want to restart on-success (Alt+F2 + r) and on-failure.
-Restart=always
-# Do not wait before restarting the shell
-RestartSec=0ms
-# Kill any stubborn child processes after this long
-TimeoutStopSec=5
-
-# Lower down gnome-shell's OOM score to avoid being killed by OOM-killer too early
-OOMScoreAdjust=-1000
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import IBus from 'gi://IBus';
-import Meta from 'gi://Meta';
import Shell from 'gi://Shell';
import * as Signals from './signals.js';
async _queueSpawn() {
const isSystemdService = await this._ibusSystemdServiceExists();
if (!isSystemdService)
- this._spawn(Meta.is_wayland_compositor() ? [] : ['--xim']);
+ this._spawn([]);
}
_tryAppendEnv(env, varname) {
import St from 'gi://St';
import * as Dialog from './dialog.js';
-import * as Main from './main.js';
const FROZEN_WINDOW_BRIGHTNESS = -0.3;
const DIALOG_TRANSITION_TIME = 150;
super._init();
this._window = window;
this._dialog = null;
- this._tracked = undefined;
this._timeoutId = 0;
}
this.response(Meta.CloseDialogResponse.FORCE_CLOSE);
}
- _onFocusChanged() {
- if (Meta.is_wayland_compositor())
- return;
-
- const focusWindow = global.display.focus_window;
- const keyFocus = global.stage.key_focus;
-
- let shouldTrack;
- if (focusWindow != null)
- shouldTrack = focusWindow === this._window;
- else
- shouldTrack = keyFocus && this._dialog.contains(keyFocus);
-
- if (this._tracked === shouldTrack)
- return;
-
- if (shouldTrack) {
- Main.layoutManager.trackChrome(this._dialog,
- {affectsInputRegion: true});
- } else {
- Main.layoutManager.untrackChrome(this._dialog);
- }
-
- // The buttons are broken when they aren't added to the input region,
- // so disable them properly in that case
- this._dialog.buttonLayout.get_children().forEach(b => {
- b.reactive = shouldTrack;
- });
-
- this._tracked = shouldTrack;
- }
-
vfunc_show() {
if (this._dialog != null)
return;
return GLib.SOURCE_CONTINUE;
});
- global.display.connectObject(
- 'notify::focus-window', this._onFocusChanged.bind(this), this);
-
- global.stage.connectObject(
- 'notify::key-focus', this._onFocusChanged.bind(this), this);
-
this._addWindowEffect();
this._initDialog();
scale_y: 1,
mode: Clutter.AnimationMode.EASE_OUT_BACK,
duration: DIALOG_TRANSITION_TIME,
- onComplete: this._onFocusChanged.bind(this),
});
}
return Clutter.EVENT_STOP;
});
button.connect('touch-event', (actor, event) => {
- // We only handle touch events here on wayland. On X11
- // we do get emulated pointer events, which already works
- // for single-touch cases. Besides, the X11 passive touch grab
- // set up by Mutter will make us see first the touch events
- // and later the pointer events, so it will look like two
- // unrelated series of events, we want to avoid double handling
- // in these cases.
- if (!Meta.is_wayland_compositor())
- return Clutter.EVENT_PROPAGATE;
-
const slot = event.get_event_sequence().get_slot();
if (!this._touchPressSlot &&
this._windowMovedId = this._focusTracker.connect('window-moved',
this._onFocusWindowMoving.bind(this));
- // Valid only for X11
- if (!Meta.is_wayland_compositor()) {
- this._focusTracker.connectObject('focus-changed', (_tracker, focused) => {
- if (focused)
- this.open(Main.layoutManager.focusIndex);
- else
- this.close();
- }, this);
- }
-
this._showIdleId = 0;
this._keyboardVisible = false;
return;
}
- const emojiVisible = Meta.is_wayland_compositor() &&
- (purpose === Clutter.InputContentPurpose.NORMAL ||
- purpose === Clutter.InputContentPurpose.ALPHA ||
- purpose === Clutter.InputContentPurpose.PASSWORD ||
- purpose === Clutter.InputContentPurpose.TERMINAL);
+ const emojiVisible = purpose === Clutter.InputContentPurpose.NORMAL ||
+ purpose === Clutter.InputContentPurpose.ALPHA ||
+ purpose === Clutter.InputContentPurpose.PASSWORD ||
+ purpose === Clutter.InputContentPurpose.TERMINAL;
keyboardModel.getLevels().forEach(currentLevel => {
const levelLayout = new KeyContainer();
this._keyboardHeightNotifyId = keyboardBox.connect('notify::height', () => {
this.translation_y = -this.height;
});
-
- // Toggle visibility so the keyboardBox can update its chrome region.
- if (!Meta.is_wayland_compositor()) {
- keyboardBox.hide();
- keyboardBox.show();
- }
}
_animateHide() {
const defaultParams = {
trackFullscreen: false,
affectsStruts: false,
- affectsInputRegion: true,
};
export const LayoutManager = GObject.registerClass({
// @actor: an actor to add to the chrome
// @params: (optional) additional params
//
- // Adds @actor to the chrome, and (unless %affectsInputRegion in
- // @params is %false) extends the input region to include it.
+ // Adds @actor to the chrome.
// Changes in @actor's size, position, and visibility will
// automatically result in appropriate changes to the input
// region.
delete this._updateRegionIdle;
}
- const rects = [], struts = [];
+ const struts = [];
const isPopupMenuVisible = global.top_window_group.get_children().some(isPopupMetaWindow);
- const wantsInputRegion =
- !this._startingUp &&
- !isPopupMenuVisible &&
- Main.modalCount === 0 &&
- !Meta.is_wayland_compositor();
for (let i = 0; i < this._trackedActors.length; i++) {
const actorData = this._trackedActors[i];
- if (!(actorData.affectsInputRegion && wantsInputRegion) && !actorData.affectsStruts)
+ if (!actorData.affectsStruts)
continue;
let [x, y] = actorData.actor.get_transformed_position();
w = Math.round(w);
h = Math.round(h);
- if (actorData.affectsInputRegion && wantsInputRegion && actorData.actor.get_paint_visibility())
- rects.push(new Mtk.Rectangle({x, y, width: w, height: h}));
-
let monitor = null;
if (actorData.affectsStruts)
monitor = this.findMonitorForActor(actorData.actor);
}
}
- if (wantsInputRegion)
- global.set_stage_input_region(rects);
-
this._isPopupWindowVisible = isPopupMenuVisible;
const workspaceManager = global.workspace_manager;
this._notificationTimeoutId = 0;
this._notificationRemoved = false;
- Main.layoutManager.addChrome(this, {affectsInputRegion: false});
- Main.layoutManager.trackChrome(this._bannerBin, {affectsInputRegion: true});
+ Main.layoutManager.addChrome(this);
+ Main.layoutManager.trackChrome(this._bannerBin);
global.display.connect('in-fullscreen-changed', this._updateState.bind(this));
animateLockScreen: animate,
fadeToBlack: true,
});
- // On wayland, a crash brings down the entire session, so we don't
- // need to defend against being restarted unlocked
- if (!Meta.is_wayland_compositor())
- global.set_runtime_state(LOCKED_STATE_STR, GLib.Variant.new('b', true));
-
// We used to set isActive and emit active-changed here,
// but now we do that from lockScreenShown, which means
// there is a 0.3 seconds window during which the lock
import Clutter from 'gi://Clutter';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
-import Meta from 'gi://Meta';
import St from 'gi://St';
import * as Main from '../main.js';
}
_onNewHandle(handle) {
- // We can't possibly know about all types of screen sharing on X11, so
- // showing these controls on X11 might give a false sense of security.
- // Thus, only enable these controls when using Wayland, where we are
- // in control of sharing.
- if (!Meta.is_wayland_compositor())
- return;
-
if (handle.isRecording)
return;
return true;
});
global.display.connect('x11-display-closing', () => {
- if (!Meta.is_wayland_compositor())
- return;
-
this._stopX11Services(null);
IBusManager.getIBusManager().restartDaemon();
Run as a full display server, rather than nested
-``--nested``
-
- Run as a nested compositor
-
``--no-x11``
Run wayland compositor without starting Xwayland
-``--x11``
-
- Run with X11 backend
-
``--wayland-display``\ =\ *DISPLAY*
Wayland display name to use
-``-d``, ``--display``\ =\ *DISPLAY*
-
- X display to use
-
``-r``, ``--replace``
Replace the running window manager
-``--sm-disable``
-
- Disable connection to the session manager
-
-``--sm-client-id``\ =\ *ID*
-
- Specify session management *ID*
-
-``--sm-save-file``\ =\ *FILE*
-
- Initialize session from *FILE*
-
-``--sync``
-
- Make X calls synchronous
-
``--mode=MODE``
Use a specific mode, e.g. "gdm" for login screen
pango_dep = dependency('pango', version: pango_req)
have_fonts = mutter_dep.get_variable('have_fonts') == 'true'
-have_x11 = mutter_dep.get_variable('have_x11') == 'true'
-have_x11_client = mutter_dep.get_variable('have_x11_client') == 'true'
-if have_x11_client or have_x11
+have_xwayland = mutter_dep.get_variable('have_xwayland') == 'true'
+if have_xwayland
x11_dep = dependency('x11')
xext_dep = dependency('xext')
xfixes_dep = dependency('xfixes')
cdata.set('HAVE_NETWORKMANAGER', have_networkmanager)
cdata.set('HAVE_PIPEWIRE', have_pipewire)
cdata.set('HAVE_SYSTEMD', have_systemd)
-cdata.set('HAVE_X11', have_x11)
-cdata.set('HAVE_X11_CLIENT', have_x11_client)
+cdata.set('HAVE_XWAYLAND', have_xwayland)
cdata.set('HAVE_FDWALK', cc.has_function('fdwalk'))
cdata.set('HAVE_MALLINFO', cc.has_function('mallinfo'))
subdir('src')
subdir('po')
-if get_option('tests') and have_x11_client
+if get_option('tests') and have_xwayland
subdir('tests')
endif
meson.add_dist_script('build-aux/check-version.py', meson.project_version(), 'NEWS')
summary_options = {
- 'x11': have_x11,
- 'x11_client': have_x11_client,
+ 'have_xwayland': have_xwayland,
'camera_monitor': get_option('camera_monitor'),
'networkmanager': get_option('networkmanager'),
'systemd': get_option('systemd'),
shell_profiler_init ();
- if (meta_context_get_compositor_type (context) == META_COMPOSITOR_TYPE_WAYLAND)
- meta_context_raise_rlimit_nofile (context, NULL);
+ meta_context_raise_rlimit_nofile (context, NULL);
if (!meta_context_start (context, &error))
{
subdir('calendar-server')
subdir('hotplug-sniffer')
subdir('st')
-if have_x11_client
+if have_xwayland
subdir('tray')
endif
pango_dep,
]
-if have_x11_client
+if have_xwayland
gnome_shell_deps += x11_dep
endif
'shell-workspace-background.h'
]
-if have_x11_client
+if have_xwayland
libshell_public_headers += [
'shell-tray-icon.h',
'shell-tray-manager.h',
'shell-wm-private.h'
]
-if have_x11_client
+if have_xwayland
libshell_private_headers += [
'shell-tray-icon-private.h',
]
'shell-workspace-background.c'
]
-if have_x11_client
+if have_xwayland
libshell_sources += [
'shell-tray-icon.c',
'shell-tray-manager.c',
libshell_no_gir_sources += dbus_generated
libshell_link_with = []
-if have_x11_client
+if have_xwayland
libshell_link_with += [libtray]
endif
#include <meta/meta-workspace-manager.h>
#include <mtk/mtk.h>
-#ifdef HAVE_X11
+#ifdef HAVE_XWAYLAND
#include <meta/meta-x11-display.h>
#endif
g_clear_object (&self->js_context);
}
-/**
- * shell_global_set_stage_input_region:
- * @global: the #ShellGlobal
- * @rectangles: (element-type Mtk.Rectangle): a list of #MtkRectangle
- * describing the input region.
- *
- * Sets the area of the stage that is responsive to mouse clicks when
- * we don't have a modal or grab.
- */
-void
-shell_global_set_stage_input_region (ShellGlobal *global,
- GSList *rectangles)
-{
-#ifdef HAVE_X11
- MtkRectangle *rect;
- XRectangle *rects;
- int nrects, i;
- GSList *r;
- MetaDisplay *display;
- MetaX11Display *x11_display;
-
- g_return_if_fail (SHELL_IS_GLOBAL (global));
-
- if (meta_is_wayland_compositor ())
- return;
-
- display = global->meta_display;
- x11_display = meta_display_get_x11_display (display);
- nrects = g_slist_length (rectangles);
- rects = g_new (XRectangle, nrects);
- for (r = rectangles, i = 0; r; r = r->next, i++)
- {
- rect = (MtkRectangle *)r->data;
- rects[i].x = rect->x;
- rects[i].y = rect->y;
- rects[i].width = rect->width;
- rects[i].height = rect->height;
- }
-
- meta_x11_display_set_stage_input_region (x11_display, rects, nrects);
- g_free (rects);
-#endif
-}
-
/**
* shell_global_get_backend:
*
use_ibeam ? META_CURSOR_TEXT : META_CURSOR_DEFAULT);
}
-#ifdef HAVE_X11
+#ifdef HAVE_XWAYLAND
static void
on_x11_display_closed (MetaDisplay *display,
ShellGlobal *global)
MetaDisplay *display;
MetaBackend *backend;
MetaSettings *settings;
-#ifdef HAVE_X11
+#ifdef HAVE_XWAYLAND
MetaX11Display *x11_display;
#endif
"End of frame, possibly including swap time",
"");
-#ifdef HAVE_X11
+#ifdef HAVE_XWAYLAND
x11_display = meta_display_get_x11_display (display);
if (x11_display && meta_x11_display_get_xdisplay (x11_display))
g_signal_connect_object (global->meta_display, "x11-display-closing",
gboolean force);
/* Input/event handling */
-void shell_global_set_stage_input_region (ShellGlobal *global,
- GSList *rectangles);
-
void shell_global_get_pointer (ShellGlobal *global,
int *x,
int *y,
return TRUE;
}
-static void
-on_after_paint (ClutterStage *stage,
- ClutterStageView *view,
- ClutterFrame *frame,
- GTask *result)
-{
- ShellScreenshot *screenshot = g_task_get_task_data (result);
- MetaDisplay *display = shell_global_get_display (screenshot->global);
- MetaCompositor *compositor = meta_display_get_compositor (display);
- GTask *task;
-
- g_signal_handlers_disconnect_by_func (stage, on_after_paint, result);
-
- if (screenshot->mode == SHELL_SCREENSHOT_AREA)
- {
- do_grab_screenshot (screenshot,
- screenshot->screenshot_area.x,
- screenshot->screenshot_area.y,
- screenshot->screenshot_area.width,
- screenshot->screenshot_area.height,
- screenshot->flags);
-
- task = g_task_new (screenshot, NULL, on_screenshot_written, result);
- g_task_run_in_thread (task, write_screenshot_thread);
- }
- else
- {
- grab_screenshot (screenshot, screenshot->flags, result);
- }
-
- g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
- (MtkRectangle *) &screenshot->screenshot_area);
-
- meta_compositor_enable_unredirect (compositor);
-}
-
/**
* shell_screenshot_screenshot:
* @screenshot: the #ShellScreenshot
if (include_cursor)
flags |= SHELL_SCREENSHOT_FLAG_INCLUDE_CURSOR;
- if (meta_is_wayland_compositor ())
- {
- grab_screenshot (screenshot, flags, result);
+ grab_screenshot (screenshot, flags, result);
- g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
- (MtkRectangle *) &screenshot->screenshot_area);
- }
- else
- {
- MetaDisplay *display = shell_global_get_display (screenshot->global);
- ClutterStage *stage = shell_global_get_stage (screenshot->global);
- MetaCompositor *compositor = meta_display_get_compositor (display);
-
- meta_compositor_disable_unredirect (compositor);
- clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- screenshot->flags = flags;
- screenshot->mode = SHELL_SCREENSHOT_SCREEN;
- g_signal_connect (stage, "after-paint",
- G_CALLBACK (on_after_paint), result);
- }
+ g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
+ (MtkRectangle *) &screenshot->screenshot_area);
}
/**
return finish_screenshot (screenshot, result, area, error);
}
-static void
-screenshot_stage_to_content_on_after_paint (ClutterStage *stage,
- ClutterStageView *view,
- ClutterFrame *frame,
- GTask *result)
-{
- ShellScreenshot *screenshot = g_task_get_task_data (result);
- MetaDisplay *display = shell_global_get_display (screenshot->global);
- MetaCompositor *compositor = meta_display_get_compositor (display);
-
- g_signal_handlers_disconnect_by_func (stage,
- screenshot_stage_to_content_on_after_paint,
- result);
-
- meta_compositor_enable_unredirect (compositor);
-
- grab_screenshot_content (screenshot, result);
-}
-
/**
* shell_screenshot_screenshot_stage_to_content:
* @screenshot: the #ShellScreenshot
g_task_set_source_tag (result, shell_screenshot_screenshot_stage_to_content);
g_task_set_task_data (result, screenshot, NULL);
- if (meta_is_wayland_compositor ())
- {
- grab_screenshot_content (screenshot, result);
- }
- else
- {
- MetaDisplay *display = shell_global_get_display (screenshot->global);
- MetaCompositor *compositor = meta_display_get_compositor (display);
- ClutterStage *stage = shell_global_get_stage (screenshot->global);
-
- meta_compositor_disable_unredirect (compositor);
- clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- g_signal_connect (stage, "after-paint",
- G_CALLBACK (screenshot_stage_to_content_on_after_paint),
- result);
- }
+ grab_screenshot_content (screenshot, result);
}
/**
screenshot->screenshot_area.width = width;
screenshot->screenshot_area.height = height;
+ do_grab_screenshot (screenshot,
+ screenshot->screenshot_area.x,
+ screenshot->screenshot_area.y,
+ screenshot->screenshot_area.width,
+ screenshot->screenshot_area.height,
+ SHELL_SCREENSHOT_FLAG_NONE);
- if (meta_is_wayland_compositor ())
- {
- do_grab_screenshot (screenshot,
- screenshot->screenshot_area.x,
- screenshot->screenshot_area.y,
- screenshot->screenshot_area.width,
- screenshot->screenshot_area.height,
- SHELL_SCREENSHOT_FLAG_NONE);
-
- g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
- (MtkRectangle *) &screenshot->screenshot_area);
-
- task = g_task_new (screenshot, NULL, on_screenshot_written, result);
- g_task_run_in_thread (task, write_screenshot_thread);
- }
- else
- {
- MetaDisplay *display = shell_global_get_display (screenshot->global);
- MetaCompositor *compositor = meta_display_get_compositor (display);
- ClutterStage *stage = shell_global_get_stage (screenshot->global);
-
- meta_compositor_disable_unredirect (compositor);
- clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- screenshot->flags = SHELL_SCREENSHOT_FLAG_NONE;
- screenshot->mode = SHELL_SCREENSHOT_AREA;
- g_signal_connect (stage, "after-paint",
- G_CALLBACK (on_after_paint), result);
- }
+ g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
+ (MtkRectangle *) &screenshot->screenshot_area);
+
+ task = g_task_new (screenshot, NULL, on_screenshot_written, result);
+ g_task_run_in_thread (task, write_screenshot_thread);
}
/**
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <meta/meta-context.h>
#include <meta/display.h>
-#ifdef HAVE_X11_CLIENT
+#ifdef HAVE_XWAYLAND
#include <meta/meta-x11-display.h>
#endif
shell_util_has_x11_display_extension (MetaDisplay *display,
const char *extension)
{
-#ifdef HAVE_X11_CLIENT
+#ifdef HAVE_XWAYLAND
MetaX11Display *x11_display;
Display *xdisplay;
int op, event, error;
#include <meta/window.h>
#include <meta/meta-workspace-manager.h>
#include <meta/meta-startup-notification.h>
-#ifdef HAVE_X11_CLIENT
+#ifdef HAVE_XWAYLAND
#include <meta/meta-x11-group.h>
#endif
get_app_from_window_group (ShellWindowTracker *tracker,
MetaWindow *window)
{
-#ifdef HAVE_X11_CLIENT
+#ifdef HAVE_XWAYLAND
ShellApp *result;
GSList *group_windows;
MetaGroup *group;
include_directories: [st_inc],
)
-if get_option('tests') and have_x11_client
+if get_option('tests') and have_xwayland
mutter_test_dep = dependency(libmutter_test_pc, version: mutter_req)
test_theme = executable('test-theme',
sources: 'test-theme.c',